/**
 * Copyright (c) Software Institude of PKU
 * All rights reserved. 
 * This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 */
package edu.pku.sei.modeler.model.uml.BasicInteractions;
// imports:
import org.w3c.dom.Element;

import edu.pku.sei.gefcommon.descriptor.annotation.MethodProperty;
import edu.pku.sei.modeler.model.common.*;
import edu.pku.sei.modeler.model.core.*;
import edu.pku.sei.modeler.model.xml.XMLUtility;

import edu.pku.sei.modeler.model.uml.Communications.MessageEvent;
import edu.pku.sei.modeler.uml.modelHelper.ModelPackage;


/**
 * @generated
 *
 */
public class MessageOccurrenceSpecification extends MessageEnd implements IMessageOccurrenceSpecification {
	// attributes
	
	
	
	
	// references
	
	protected MetaTypedList event;
	
	protected MetaTypedList message;
	
	protected MetaTypedList toAfter;
	
	protected MetaTypedList toBefore;
	
	protected MetaTypedList generalOrdering;
	
	// getters & setters for attributes
	
	// getters for references
	
	public MetaTypedList getMessage() {
		if (message == null) {
			message = new MetaTypedList(Message.class, this, ModelPackage.INTERACTION_MESSAGE);
		}
		return message;
	}
	
	public MetaTypedList getEvent() {
		if(event == null) {
			event = new MetaTypedList(MessageEvent.class, this, ModelPackage.MESSAGEOCCURRENCESPECIFICATION_EVENT);
		}
		return event;
	}
	
	public MetaTypedList getToAfter() {
		if(toAfter == null) {
			toAfter = new MetaTypedList(GeneralOrdering.class, this, ModelPackage.OCCURRENCESPECIFICATION_TOAFTER);
		}
		return toAfter;
	}
	
	public MetaTypedList getToBefore() {
		if(toBefore == null) {
			toBefore = new MetaTypedList(GeneralOrdering.class, this, ModelPackage.OCCURRENCESPECIFICATION_TOBEFORE);
		}
		return toBefore;
	}
	
	public MetaTypedList getGeneralOrdering() {
		if(generalOrdering == null) {
			generalOrdering = new MetaTypedList(GeneralOrdering.class, this, ModelPackage.INTERACTIONFRAGMENT_GENERALORDERING);
		}
		return generalOrdering;
	}
	
	// save & load
	public void serialize(Element root) {
		super.serialize(root);
		// attributes
		
		// references
		
		XMLUtility.xmlInstance.serializeNodesNotContain(root, ModelPackage.MESSAGEOCCURRENCESPECIFICATION_EVENT, event);		
		
		XMLUtility.xmlInstance.serializeNodes(root, ModelPackage.OCCURRENCESPECIFICATION_TOAFTER, toAfter);
		
		XMLUtility.xmlInstance.serializeNodes(root, ModelPackage.OCCURRENCESPECIFICATION_TOBEFORE, toBefore);
		
		XMLUtility.xmlInstance.serializeNodes(root, ModelPackage.INTERACTIONFRAGMENT_GENERALORDERING, generalOrdering);
		
	}
	
	public void deSerialize(Element root) {
		super.deSerialize(root);
		// attributes
		
		// references
		
		this.getEvent().addAll(XMLUtility.xmlInstance.deSerializeNodesNotContain(root, ModelPackage.MESSAGEOCCURRENCESPECIFICATION_EVENT, this));
		
		this.getToAfter().addAll(XMLUtility.xmlInstance.deSerializeNodes(root, ModelPackage.OCCURRENCESPECIFICATION_TOAFTER));
		
		this.getToBefore().addAll(XMLUtility.xmlInstance.deSerializeNodes(root, ModelPackage.OCCURRENCESPECIFICATION_TOBEFORE));
		
		this.getGeneralOrdering().addAll(XMLUtility.xmlInstance.deSerializeNodes(root, ModelPackage.INTERACTIONFRAGMENT_GENERALORDERING));
		
	}
	
	public void dynamicSet(String featureID, Object value) {
		if(featureID == null || "".equals(featureID)) {
			return;
		}
		// attributes
		
		// references
		
		else if(ModelPackage.MESSAGEOCCURRENCESPECIFICATION_EVENT.equals(featureID)) {
			getEvent().add(value);
		}
		
		else
			super.dynamicSet(featureID, value);
	}
}
 
 
 
 
 